What is the proper way of passing js variable to encoded route